package com.example.training.model.web;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;

@Data
@Accessors(chain = true)
public class Result<T> implements Serializable {

    @Serial
    private static final long serialVersionUID = 5679018624309023727L;

    public static final String SUCCESS_CODE = "0";

    private String code;

    private String message;

    private T data;


    public Result(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
    public Result() {

    }

    public boolean isSuccess() {
        return SUCCESS_CODE.equals(code);
    }

}
